#ifndef _PHYSICS_H_
#define _PHYSICS_H_

#include <windows.h>

class CPhysicEngine
{
private:
	static CPhysicEngine * _inst;
	static unsigned int __stdcall _thread_entrypoint(void * args);
	HANDLE _physics_thread_handle;
	volatile unsigned int _is_running;

	void _init();

protected:
	CPhysicEngine();
	CPhysicEngine(const CPhysicEngine & r);
	CPhysicEngine & operator = (const CPhysicEngine & r);
public:
	inline static CPhysicEngine * create() {return (_inst = new CPhysicEngine());}
	inline static CPhysicEngine * getInstance() {return _inst;}
	inline void run() const {ResumeThread(_physics_thread_handle);}
};


#endif // _PHYSICS_H_